home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Windows 95 API Bible
/
Windows 95 API Bible 3 Disc Set.iso
/
Win32 API Bible Book 1 of 3
/
CHAPTE22
/
EX3.C
< prev
next >
Wrap
C/C++ Source or Header
|
1995-05-31
|
2KB
|
53 lines
#include <genstub.c>
LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch (uMsg)
{
case WM_COMMAND:
switch ( LOWORD( wParam ) )
{
case IDM_TEST:
{
int i;
HFONT hOldFont;
TCHAR szTemp[64];
TCHAR szBuffer[128];
static TCHAR szFrench[] = { 0x41, 0xee, 0x6e, 0xe9, 0 };
static TCHAR szStart [26] = "Special characters here: ";
LPTSTR lpTstr = szTemp;
HDC hDC = GetDC( hWnd );
lstrcpy( szTemp, szStart );
lstrcat( szTemp, szFrench );
TextOut( hDC, 0, 0, szBuffer, wsprintf( szBuffer,
"String is [%s]", szTemp ) );
// advance to char 26, CharNext(0) 25 times...
for (i=0; i<26; i++)
lpTstr = CharNext(lpTstr );
TextOut( hDC, 0, 20, szBuffer,
wsprintf( szBuffer, "Char 26 is %c", *lpTstr ) );
// move back 5 characters
for (i=0; i<5; i++)
lpTstr = CharPrev( szTemp, lpTstr );
TextOut( hDC, 0, 40, szBuffer, wsprintf( szBuffer,
"Char 26-5 is %c", *lpTstr ) );
ReleaseDC( hWnd, hDC );
}
break;
case IDM_EXIT:
DestroyWindow( hWnd );
break;
}
break;
case WM_DESTROY:
PostQuitMessage( 0 );
break;
default:
return (DefWindowProc(hWnd, uMsg, wParam, lParam));
}
return (NULL);
}